package com.cskaoyan.service;

import com.cskaoyan.bean.MarketGoodsSpecification;
import com.cskaoyan.mapper.MarketGoodsSpecificationMapper;
import com.cskaoyan.util.MyBatisUtil;
import com.cskaoyan.util.TransactionUtil;

import java.util.Date;

public class SpecificationServiceImpl implements SpecificationService {
    @Override
    public int add(MarketGoodsSpecification specification) {
        MarketGoodsSpecificationMapper goodsSpecificationMapper = TransactionUtil.getMapper(MarketGoodsSpecificationMapper.class);
        Date now = new Date();
        specification.setAddTime(now);
        specification.setUpdateTime(now);
        return goodsSpecificationMapper.insertSelective(specification);
    }
    @Override
    public int flash(MarketGoodsSpecification specification) {

        MarketGoodsSpecificationMapper goodsSpecificationMapper = MyBatisUtil.getMapper(MarketGoodsSpecificationMapper.class);
        Date now = new Date();
//        specification.setAddTime(now);
        specification.setUpdateTime(now);

        int b = goodsSpecificationMapper.updateByPrimaryKey(specification);

        return b;
    }
}

